<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitFudaiRecord extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 福袋
        Schema::create('fudai_records', function (Blueprint $table) {
            $table->comment = '福袋开盒记录表';
            
            $table->increments('id');
            $table->uuid('uuid')->index();

            $table->integer('node_id')->index()->comment('一番赏id');
            // $table->integer('room_id')->index()->comment('房间id');
            $table->integer('open_index')->nullable()->comment('开盒序号');
            
            $table->integer('sku_id')->index()->comment('开出的sku id');
            // $table->boolean('sku_type')->default(0)->index()->comment('0为普通款 1为隐藏款');
            $table->integer('user_id')->index()->comment('用户id');

            $table->boolean('is_free_order')->default(0)->index()->comment('是否免单');

            $table->json('user')->nullable()->comment('用户信息');
            $table->json('sku')->nullable()->comment('盒子');
            $table->integer('level')->default(1)->index()->comment('物品等级');
            $table->integer('total')->default(1)->comment('物品数量');

            $table->string('level_title', 30)->nullable()->comment('等级标题');

            $table->softDeletes();
            $table->timestamps();
            
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
